package dto

import (
	"mall-go/model"
	"strconv"
)

type UserAddressDTO struct {
	AddressID     string `json:"addressId"`
	UserID        uint   `json:"userId"`
	UserName      string `json:"userName"`
	UserPhone     string `json:"userPhone"`
	DefaultFlag   uint   `json:"defaultFlag"`
	ProvinceName  string `json:"provinceName"`
	CityName      string `json:"cityName"`
	RegionName    string `json:"regionName"`
	DetailAddress string `json:"detailAddress"`
}

func ToUserAddressDTO(userAddress *model.UserAddress) UserAddressDTO {
	return UserAddressDTO{
		AddressID:     strconv.Itoa(int(userAddress.AddressID)),
		UserID:        userAddress.UserID,
		UserName:      userAddress.UserName,
		UserPhone:     userAddress.UserPhone,
		DefaultFlag:   userAddress.DefaultFlag,
		ProvinceName:  userAddress.ProvinceName,
		CityName:      userAddress.CityName,
		RegionName:    userAddress.RegionName,
		DetailAddress: userAddress.DetailAddress,
	}
}
